<template>
    <div class="page_root" :key="queryUpdateFlag" data-page-name="1" data-page-identification="x_hb0xe6o0k2">
        <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
            <!-- begin vid_q2pj193dfc 自定义模板_7xu4mdl9mj -->
            <!--          新建/编辑周报-->

            <a-modal
                :visible="state.visible"
                :title="state.title"
                width="864px"
                @ok="confirmRecord"
                @cancel="cancelRecord"
                centered
                :mask-closable="false"
                destroy-on-close
                :body-style="{
                    height: '700px',
                    overflowY: 'auto',
                    paddingBottom: '0'
                }"
                :ok-button-props="{ loading: state.okBtnLoading }"
            >
                <a-form :model="state.formModel" ref="formRef">
                    <div class="my-page">
                        <div class="form-top">
                            <a-row>
                                <a-col :span="12">
                                    <a-form-item
                                        label="区域名称"
                                        :rules="[{ required: true, message: '请选择区域名称！' }]"
                                        name="configAreaId"
                                    >
                                        <a-select
                                            v-model:value="state.formModel.configAreaId"
                                            placeholder="请选择区域名称"
                                            :options="state.regionList"
                                            :field-names="{ label: 'regionName', value: 'id' }"
                                            :filterOption="
                                                (input, option) => {
                                                    return (
                                                        option.regionName.toLowerCase().indexOf(input.toLowerCase()) >=
                                                        0
                                                    )
                                                }
                                            "
                                            @change="getLast"
                                        />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="12">
                                    <a-form-item
                                        label="工厂名称"
                                        :rules="[{ required: true, message: '请选择工厂名称！' }]"
                                        name="factoryCode"
                                    >
                                        <a-tree-select
                                            v-model:value="state.formModel.factoryCode"
                                            show-search
                                            style="width: 100%"
                                            placeholder="请选择"
                                            allow-clear
                                            :tree-data="state.treeData"
                                            :fieldNames="{
                                                children: 'children',
                                                label: 'projectName',
                                                value: 'projectId'
                                            }"
                                            :filterTreeNode="
                                                (inputValue, treeNode) => {
                                                    return (
                                                        treeNode.projectName
                                                            .toLowerCase()
                                                            .indexOf(inputValue.toLowerCase()) >= 0
                                                    )
                                                }
                                            "
                                            :max-tag-count="1"
                                            @change="getLast"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <a-row>
                                <a-col :span="12">
                                    <a-form-item
                                        label="时间范围"
                                        :rules="[{ required: true, message: '请选择时间范围！' }]"
                                        name="time"
                                    >
                                        <a-date-picker
                                            style="width: 100%"
                                            v-model:value="state.formModel.time"
                                            picker="week"
                                            :format="weekFormat"
                                            @change="handleFormWeekChange"
                                        />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="12">
                                    <a-form-item
                                        label="项目阶段"
                                        :rules="[{ required: true, message: '请选择项目阶段', trigger: 'blur' }]"
                                        name="stageId"
                                    >
                                        <a-select
                                            show-search
                                            placeholder="请选择"
                                            @focus="getMilepost"
                                            v-model:value="state.formModel.stageId"
                                            :options="state.miltpostList"
                                            :field-names="{ label: 'stageName', value: 'templateStageId' }"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <div class="title-tip"> 项目整体健康状态 </div>
                            <div class="color-content">
                                <div class="color-tip">
                                    <div class="color-item">
                                        <div class="cycle-green"></div>
                                        <div class="color-msg">项目当前无异常</div>
                                    </div>
                                </div>
                                <div class="color-tip">
                                    <div class="color-item">
                                        <div class="cycle-orange"></div>
                                        <div class="color-msg">低风险、在可控范围内</div>
                                    </div>
                                </div>
                                <div class="color-tip">
                                    <div class="color-item">
                                        <div class="cycle-red"></div>
                                        <div class="color-msg">中风险、需相关领导关注</div>
                                    </div>
                                </div>
                                <div class="color-tip">
                                    <div class="color-item">
                                        <div class="cycle-black"></div>
                                        <div class="color-msg">重大风险，需要专题会议，领导决策</div>
                                    </div>
                                </div>
                            </div>
                            <a-row>
                                <a-col :span="12">
                                    <a-form-item
                                        label="范围"
                                        :rules="[{ required: true, message: '请选择范围健康状态！' }]"
                                        name="healthRangeName"
                                    >
                                        <a-radio-group
                                            v-model:value="state.formModel.healthRangeName"
                                            :options="plainOptions"
                                        />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="12">
                                    <a-form-item
                                        label="计划"
                                        :rules="[{ required: true, message: '请选择计划健康状态！' }]"
                                        name="healthPlanName"
                                    >
                                        <a-radio-group
                                            v-model:value="state.formModel.healthPlanName"
                                            :options="plainOptions"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <a-row>
                                <a-col :span="12">
                                    <a-form-item
                                        label="团队"
                                        :rules="[{ required: true, message: '请选择团队健康状态！' }]"
                                        name="healthTeamName"
                                    >
                                        <a-radio-group
                                            v-model:value="state.formModel.healthTeamName"
                                            :options="plainOptions"
                                        />
                                    </a-form-item>
                                </a-col>
                                <a-col :span="12">
                                    <a-form-item
                                        label="夸组协同"
                                        :rules="[{ required: true, message: '请选择夸组协同健康状态！' }]"
                                        name="healthCrossGroupName"
                                    >
                                        <a-radio-group
                                            v-model:value="state.formModel.healthCrossGroupName"
                                            :options="plainOptions"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <a-row>
                                <a-col :span="12">
                                    <a-form-item
                                        label="问题风险"
                                        :rules="[{ required: true, message: '请选择问题风险健康状态！' }]"
                                        name="healthProblemRiskName"
                                    >
                                        <a-radio-group
                                            v-model:value="state.formModel.healthProblemRiskName"
                                            :options="plainOptions"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <a-row>
                                <a-col :span="24">
                                    <a-form-item label="特别说明">
                                        <a-textarea
                                            v-model:value="state.formModel.healthRemark"
                                            placejolder="请输入特别说明"
                                            :row="2"
                                        />
                                    </a-form-item>
                                </a-col>
                            </a-row>
                            <div class="title-tip"> 进度说明 </div>
                            <div class="progress-description">
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="主要完成工作"
                                            :rules="[{ required: true, message: '请输入主要完成工作！' }]"
                                            name="progressFinish"
                                        >
                                            <a-textarea
                                                v-model:value="state.formModel.progressFinish"
                                                placejolder="请输入主要完成工作"
                                                :row="2"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="主要工作目标"
                                            :rules="[{ required: true, message: '请输入主要工作目标！' }]"
                                            name="progressGoals"
                                        >
                                            <a-textarea
                                                v-model:value="state.formModel.progressGoals"
                                                placejolder="请输入主要工作目标"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </div>
                            <div v-for="(item, index) in state.formModel.weekReportActionFormList">
                                <div class="flex-div">
                                    <div class="left-title">持续跟进事项{{ index + 1 }}</div>
                                    <div class="right-btn">
                                        <a-button
                                            type="primary"
                                            size="small"
                                            class="del"
                                            ghost
                                            @click="handlerDeleteAction(index)"
                                            >删除</a-button
                                        >
                                    </div>
                                </div>
                                <a-row :span="24">
                                    <a-col :span="24">
                                        <a-form-item
                                            label="持续跟进事项"
                                            :rules="[{ required: true, message: '请输入持续跟进事项！' }]"
                                            :name="['weekReportActionFormList', index, 'actionName']"
                                        >
                                            <a-textarea
                                                v-model:value="
                                                    state.formModel.weekReportActionFormList[index].actionName
                                                "
                                                placejolder="请输入持续跟进事项"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row :span="24">
                                    <a-col :span="24">
                                        <a-form-item
                                            label="行动建议"
                                            :rules="[{ required: true, message: '请输入持续行动建议！' }]"
                                            :name="['weekReportActionFormList', index, 'actionSuggest']"
                                        >
                                            <a-textarea
                                                v-model:value="
                                                    state.formModel.weekReportActionFormList[index].actionSuggest
                                                "
                                                placejolder="请输入持续行动建议"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="提出日期"
                                            :rules="[{ required: true, message: '请选择提出日期！' }]"
                                            :name="['weekReportActionFormList', index, 'actionHappenDate']"
                                        >
                                            <a-date-picker
                                                v-model:value="
                                                    state.formModel.weekReportActionFormList[index].actionHappenDate
                                                "
                                                style="width: 100%"
                                                value-format="YYYY-MM-DD"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="预计完成日期"
                                            :rules="[{ required: true, message: '请选择预计完成日期！' }]"
                                            :name="['weekReportActionFormList', index, 'actionFinishDate']"
                                        >
                                            <a-date-picker
                                                v-model:value="
                                                    state.formModel.weekReportActionFormList[index].actionFinishDate
                                                "
                                                value-format="YYYY-MM-DD"
                                                style="width: 100%"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="是否完成"
                                            :rules="[{ required: true, message: '请选择是否完成！' }]"
                                            :name="['weekReportActionFormList', index, 'isFinish']"
                                        >
                                            <a-radio-group
                                                v-model:value="state.formModel.weekReportActionFormList[index].isFinish"
                                            >
                                                <a-radio value="是">是</a-radio>
                                                <a-radio value="否">否</a-radio>
                                            </a-radio-group>
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item label="备注">
                                            <a-textarea
                                                v-model:value="state.formModel.weekReportActionFormList[index].remark"
                                                placeholder="请输入备注"
                                                :row="2"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </div>
                            <a-button type="primary" ghost class="add-btn" @click="handlerAddAction">
                                <plus-outlined />
                                新增
                            </a-button>
                            <div v-for="(item, index) in state.formModel.weekReportProblemRiskDecisionFormList">
                                <div class="flex-div">
                                    <div class="left-title">问题、风险及待决策事项{{ index + 1 }}</div>
                                    <div class="right-btn">
                                        <a-button
                                            type="primary"
                                            size="small"
                                            class="del"
                                            ghost
                                            @click="handlerDeleteQuestion(index)"
                                            >删除</a-button
                                        >
                                    </div>
                                </div>

                                <a-row>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="责任人"
                                            :rules="[{ required: true, message: '请选择责任人！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'responsibleName']"
                                        >
                                            <!--                                            <a-select-->
                                            <!--                                                v-model:value="-->
                                            <!--                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]-->
                                            <!--                                                        .responsibleName-->
                                            <!--                                                "-->
                                            <!--                                                allowClear-->
                                            <!--                                                showSearch-->
                                            <!--                                                :options="peopleList"-->
                                            <!--                                                :field-names="{ label: 'label', value: 'value' }"-->
                                            <!--                                                :filter-option="-->
                                            <!--                                                    (input, option) => {-->
                                            <!--                                                        return (-->
                                            <!--                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0-->
                                            <!--                                                        )-->
                                            <!--                                                    }-->
                                            <!--                                                "-->
                                            <!--                                            />-->
                                            <a-textarea
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .responsibleName
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="责任类型"
                                            :rules="[{ required: true, message: '请选择责任类型！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'category']"
                                        >
                                            <a-radio-group
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .category
                                                "
                                            >
                                                <a-radio value="问题">问题</a-radio>
                                                <a-radio value="风险">风险</a-radio>
                                                <a-radio value="决策">决策</a-radio>
                                            </a-radio-group>
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="问题/风险等级"
                                            :rules="[{ required: true, message: '请选择问题/风险等级！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'problemRisk']"
                                        >
                                            <a-radio-group
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .problemRisk
                                                "
                                            >
                                                <a-radio value="高">高</a-radio>
                                                <a-radio value="中">中</a-radio>
                                                <a-radio value="低">低</a-radio>
                                            </a-radio-group>
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="事项描述"
                                            :rules="[{ required: true, message: '请输入事项描述！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'actionName']"
                                        >
                                            <a-textarea
                                                placejolder="请输入事项描述"
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .actionName
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="行动建议"
                                            :rules="[{ required: true, message: '请输入持续行动建议！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'actionSuggest']"
                                        >
                                            <a-textarea
                                                placejolder="请输入持续行动建议"
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .actionSuggest
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="提出日期"
                                            :rules="[{ required: true, message: '请选择提出日期！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'actionHappenDate']"
                                        >
                                            <a-date-picker
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .actionHappenDate
                                                "
                                                style="width: 100%"
                                                value-format="YYYY-MM-DD"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="预计完成日期"
                                            :rules="[{ required: true, message: '请选择预计完成日期！' }]"
                                            :name="['weekReportProblemRiskDecisionFormList', index, 'actionHappenDate']"
                                        >
                                            <a-date-picker
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index]
                                                        .actionFinishDate
                                                "
                                                style="width: 100%"
                                                value-format="YYYY-MM-DD"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                                <a-row>
                                    <a-col :span="24">
                                        <a-form-item label="备注">
                                            <a-textarea
                                                v-model:value="
                                                    state.formModel.weekReportProblemRiskDecisionFormList[index].remark
                                                "
                                                placeholder="请输入备注"
                                                :row="2"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </div>
                            <a-button type="primary" ghost class="add-btn" @click="handlerAddQuestion">
                                <plus-outlined />
                                新增
                            </a-button>
                        </div>
                    </div>
                </a-form>
            </a-modal>
            <!--          新建/编辑周报-->
            <!--          删除周报-->
            <a-modal
                :visible="state.deleteVisible"
                title="删除"
                @ok="confirmDeleteWork"
                @cancel="state.deleteVisible = false"
                centered
            >
                确定删除这条周报吗？
            </a-modal>
            <!--          删除周报-->
            <!--变更记录-->
            <a-modal
                :visible="state.changeVisible"
                title="变更记录"
                centered
                @cancel="state.changeVisible = false"
                :footer="null"
                width="1000px"
            >
                <div class="default-table">
                    <a-table
                        bordered
                        :columns="columns"
                        :data-source="state.changeRecord"
                        :scroll="{ y: 600 }"
                        :pagination="false"
                    />
                </div>
            </a-modal>
            <!--变更记录-->
            <div class="body">
                <div class="top-search">
                    <div>
                        <a-row :gutter="24">
                            <a-col :span="5">
                                <a-form-item label="区域名称">
                                    <a-select
                                        allow-clear
                                        v-model:value="state.filterRegion"
                                        placeholder="请选择区域名称"
                                        :options="state.regionList"
                                        :field-names="{ label: 'regionName', value: 'id' }"
                                        :filterOption="
                                            (input, option) => {
                                                return option.regionName.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        @change="getDataList"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="5">
                                <a-form-item label="时间范围">
                                    <a-date-picker
                                        style="width: 100%"
                                        v-model:value="state.searchWeek"
                                        picker="week"
                                        :format="weekFormat"
                                        @change="handleWeekChange"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                    </div>
                </div>
                <a-spin :spinning="state.spinng" tip="加载中...">
                    <div class="content">
                        <div class="no-data-img" v-if="state.dataSource.length && state.dataSource.length == 0">
                            <svg
                                xmlns="http://www.w3.org/2000/svg"
                                xmlns:xlink="http://www.w3.org/1999/xlink"
                                width="265px"
                                height="192px"
                                viewBox="0 0 265 192"
                                version="1.1"
                            >
                                <title>暂无待办事项</title>
                                <defs>
                                    <linearGradient
                                        x1="50%"
                                        y1="85.1278551%"
                                        x2="50%"
                                        y2="-24.3022005%"
                                        id="linearGradient-1"
                                    >
                                        <stop stop-color="#3875FF" stop-opacity="0" offset="0%" />
                                        <stop stop-color="#3875FF" stop-opacity="0.2" offset="100%" />
                                    </linearGradient>
                                    <linearGradient
                                        x1="50%"
                                        y1="85.1278551%"
                                        x2="50%"
                                        y2="-24.3022005%"
                                        id="linearGradient-2"
                                    >
                                        <stop stop-color="#3875FF" stop-opacity="0" offset="0%" />
                                        <stop stop-color="#3875FF" stop-opacity="0.2" offset="100%" />
                                    </linearGradient>
                                    <linearGradient
                                        x1="50%"
                                        y1="85.1278551%"
                                        x2="50%"
                                        y2="-24.3022005%"
                                        id="linearGradient-3"
                                    >
                                        <stop stop-color="#3875FF" stop-opacity="0" offset="0%" />
                                        <stop stop-color="#3875FF" stop-opacity="0.2" offset="100%" />
                                    </linearGradient>
                                    <linearGradient x1="50%" y1="50%" x2="50%" y2="-4.79965365%" id="linearGradient-4">
                                        <stop stop-color="#3875FF" stop-opacity="0" offset="0%" />
                                        <stop stop-color="#3875FF" stop-opacity="0.1" offset="100%" />
                                    </linearGradient>
                                    <linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="linearGradient-5">
                                        <stop stop-color="#9CBEF7" offset="0%" />
                                        <stop stop-color="#96D1F7" offset="100%" />
                                    </linearGradient>
                                    <linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="linearGradient-6">
                                        <stop stop-color="#9CBEF7" offset="0%" />
                                        <stop stop-color="#96D1F7" offset="100%" />
                                    </linearGradient>
                                </defs>
                                <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                    <g id="审批管理-暂无待办事项" transform="translate(-927, -470)">
                                        <g id="暂无待办事项" transform="translate(927, 470)">
                                            <g id="编组-69备份-3备份-3" fill-rule="nonzero">
                                                <path
                                                    d="M30.4,70.4 C38.3897145,70.4 44.9396432,76.4022329 45.5530639,84.0283112 C45.8323774,84.0092712 46.1150286,84 46.4,84 C53.027417,84 58.4,89.0144112 58.4,95.2 C58.4,101.385589 53.027417,106.4 46.4,106.4 C46.1313282,106.4 45.8647188,106.391759 45.6004459,106.375534 L45.6,107.2 L8.8,107.2 L8.80006856,105.99739 C3.72613437,104.690379 0,100.351322 0,95.2 C0,89.0144112 5.372583,84 12,84 C13.1159648,84 14.1963502,84.1421776 15.2214963,84.4081848 C15.6437054,76.6027782 22.2779069,70.4 30.4,70.4 Z"
                                                    id="形状结合备份"
                                                    fill="url(#linearGradient-1)"
                                                />
                                                <path
                                                    d="M174.4,35.2 L174.400166,35.1009906 C168.085987,34.3137074 163.2,28.9274454 163.2,22.4 C163.2,15.3307552 168.930755,9.6 176,9.6 C177.223344,9.6 178.406604,9.77161808 179.527019,10.0920919 C181.87653,4.17968127 187.650157,0 194.4,0 C202.141022,0 208.598072,5.49733733 210.080147,12.8010091 C216.449395,12.8415186 221.6,17.8400063 221.6,24 C221.6,30.0561716 216.621551,34.98966 210.40049,35.1934501 L210.4,35.2 L174.4,35.2 Z"
                                                    id="形状结合"
                                                    fill="url(#linearGradient-2)"
                                                    transform="translate(192.4, 17.6) scale(-1, 1) translate(-192.4, -17.6)"
                                                />
                                                <path
                                                    d="M242.8,47.2 C247.491543,47.2 251.362882,50.7117164 251.928816,55.249951 C252.214523,55.2167339 252.505192,55.2 252.8,55.2 C256.77645,55.2 260,58.2444637 260,62 C260,65.7555363 256.77645,68.8 252.8,68.8 C252.529676,68.8 252.262831,68.7859302 252.000242,68.7585236 L252,69.6 L229.6,69.6 L229.600068,68.6315132 C226.393652,67.9443906 224,65.2361993 224,62 C224,58.2444637 227.22355,55.2 231.2,55.2 C232.054514,55.2 232.874259,55.3405911 233.634718,55.5986176 C234.040539,50.892793 237.989021,47.2 242.8,47.2 Z"
                                                    id="形状结合备份-2"
                                                    fill="url(#linearGradient-3)"
                                                />
                                                <g id="编组-50" transform="translate(1.6, 76.8)">
                                                    <ellipse
                                                        id="椭圆形"
                                                        fill="url(#linearGradient-4)"
                                                        cx="131.6"
                                                        cy="57.6"
                                                        rx="131.6"
                                                        ry="57.6"
                                                    />
                                                    <g id="编组-46" transform="translate(30.4, 4.8)">
                                                        <rect
                                                            id="矩形"
                                                            fill="#D7E3FF"
                                                            x="6.4"
                                                            y="20"
                                                            width="2.4"
                                                            height="12"
                                                        />
                                                        <path
                                                            d="M8.4,21.5460356 C25.469423,21.5460356 11.8000002,-1.42108547e-14 8.4,-1.42108547e-14 C4.99999998,-1.42108547e-14 -8.66942296,21.5460356 8.4,21.5460356 Z"
                                                            id="椭圆形"
                                                            fill="#EAF0FF"
                                                        />
                                                    </g>
                                                    <g id="编组-46备份-2" transform="translate(218.4, 4.8)">
                                                        <rect
                                                            id="矩形"
                                                            fill="#D7E3FF"
                                                            x="4.97664"
                                                            y="13.824"
                                                            width="1.65888"
                                                            height="8.2944"
                                                        />
                                                        <path
                                                            d="M5.80608,14.8926198 C17.6044651,14.8926198 8.15616008,-9.8225428e-15 5.80608,-9.8225428e-15 C3.45599989,-9.8225428e-15 -5.99230512,14.8926198 5.80608,14.8926198 Z"
                                                            id="椭圆形"
                                                            fill="#EAF0FF"
                                                        />
                                                    </g>
                                                    <g id="编组-46备份" transform="translate(245.6, 21.6)">
                                                        <rect
                                                            id="矩形"
                                                            fill="#D7E3FF"
                                                            x="3.6"
                                                            y="10"
                                                            width="1.2"
                                                            height="6"
                                                        />
                                                        <path
                                                            d="M4.2,10.7730178 C12.7347114,10.7730178 5.90000008,-7.10542736e-15 4.2,-7.10542736e-15 C2.5,-7.10542736e-15 -4.33471146,10.7730178 4.2,10.7730178 Z"
                                                            id="椭圆形"
                                                            fill="#EAF0FF"
                                                        />
                                                    </g>
                                                </g>
                                            </g>
                                            <g id="编组-61" transform="translate(89.6, 21.6)">
                                                <ellipse
                                                    id="椭圆形"
                                                    fill="#E2EBFF"
                                                    fill-rule="nonzero"
                                                    cx="42.8"
                                                    cy="80"
                                                    rx="42.8"
                                                    ry="4.8"
                                                />
                                                <rect
                                                    id="矩形备份-91"
                                                    fill="url(#linearGradient-5)"
                                                    x="5.6"
                                                    y="0"
                                                    width="70.4"
                                                    height="80.8"
                                                    rx="3.2"
                                                />
                                                <g
                                                    id="编组-60"
                                                    transform="translate(20.8, 28)"
                                                    fill="#FFFFFF"
                                                    fill-rule="nonzero"
                                                >
                                                    <rect id="矩形" x="0" y="0" width="40" height="3.2" rx="1.6" />
                                                    <rect
                                                        id="矩形备份-92"
                                                        x="0"
                                                        y="15.2"
                                                        width="40"
                                                        height="3.2"
                                                        rx="1.6"
                                                    />
                                                    <rect
                                                        id="矩形备份-93"
                                                        x="0"
                                                        y="30.4"
                                                        width="40"
                                                        height="3.2"
                                                        rx="1.6"
                                                    />
                                                </g>
                                                <path
                                                    d="M21.6,0 L60.7346814,0 L55.7992343,8.40508424 C55.6555754,8.64973584 55.393086,8.8 55.1093744,8.8 L27.225307,8.8 C26.9415954,8.8 26.6791059,8.64973584 26.535447,8.40508424 L21.6,0 L21.6,0 Z"
                                                    id="矩形"
                                                    fill="#FFFFFF"
                                                    fill-rule="nonzero"
                                                />
                                                <rect
                                                    id="矩形备份-94"
                                                    fill="url(#linearGradient-6)"
                                                    x="29.6"
                                                    y="0"
                                                    width="23.2"
                                                    height="3.2"
                                                    rx="1.6"
                                                />
                                            </g>
                                        </g>
                                    </g>
                                </g>
                            </svg>
                            <div class="no-data-msg">暂无数据</div>
                        </div>
                        <div class="record-item" v-for="(item, index) in state.dataSource">
                            <div class="item-title">
                                <div class="title-left">
                                    <div class="title-icon">
                                        <svg
                                            style="margin-top: 7px"
                                            xmlns="http://www.w3.org/2000/svg"
                                            xmlns:xlink="http://www.w3.org/1999/xlink"
                                            width="16px"
                                            height="16px"
                                            viewBox="0 0 16 16"
                                            version="1.1"
                                        >
                                            <title>区域名称</title>
                                            <g
                                                id="页面-1"
                                                stroke="none"
                                                stroke-width="1"
                                                fill="none"
                                                fill-rule="evenodd"
                                            >
                                                <g id="客户协作端2-区域列表" transform="translate(-264, -164)">
                                                    <g id="区域名称" transform="translate(264, 164)">
                                                        <rect id="矩形" x="0" y="0" width="16" height="16" />
                                                        <g
                                                            id="编组"
                                                            transform="translate(1, 2)"
                                                            stroke="#3875FF"
                                                            stroke-linecap="round"
                                                            stroke-linejoin="round"
                                                        >
                                                            <polygon
                                                                id="路径"
                                                                fill="#3875FF"
                                                                fill-rule="nonzero"
                                                                points="4.9 6.3 2.8 9.45 0 7.875 0 12.6 14 12.6 14 3.15 11.55 5.95 9.45 4.2 7 7"
                                                            />
                                                            <polyline
                                                                id="路径"
                                                                points="0 7.875 0 3.85 2.45 5.95 4.375 3.15 6.475 4.2 9.45 1.05 11.375 2.625 14 0 14 3.325"
                                                            />
                                                        </g>
                                                    </g>
                                                </g>
                                            </g></svg
                                        ><span class="title-name">{{ item.projectName }}</span></div
                                    >
                                    <div class="time-range normal-font">
                                        时间范围：
                                        <span class="weight-font">{{ item.startDate }}--{{ item.endDate }}</span>
                                    </div>
                                    <div class="normal-font sub-time">
                                        最近提交时间：
                                        <span class="weight-font">{{ item.updateTime }}</span>
                                    </div>
                                    <div class="normal-font create-time">
                                        创建时间：
                                        <span class="weight-font">{{ item.createdTime }}</span>
                                    </div>
                                </div>
                                <div class="title-right">
                                    <a-space>
                                        看板展示： <a-switch @click="changeShow(checked,item)" v-model:value="item.viewStatus" />
                                        <a-button type="primary" size="small" ghost @click="handleEdit(item)"
                                            >编辑</a-button
                                        >
                                        <a-button type="primary" size="small" ghost @click="handleDelete(item)"
                                            >删除</a-button
                                        >
                                        <a-button type="primary" size="small" ghost @click="handleCheck(item)"
                                            >变更记录</a-button
                                        >
                                    </a-space>
                                </div>
                            </div>
                            <div class="kb-table-box">
                                <a-table bordered :columns="healthColumns" :data-source="[item]" :pagination="false">
                                    <template #bodyCell="{ column, record, text }">
                                        <template
                                            v-if="
                                                column.dataIndex === 'healthRangeName' ||
                                                column.dataIndex === 'healthPlanName' ||
                                                column.dataIndex === 'healthTeamName' ||
                                                column.dataIndex === 'healthCrossGroupName' ||
                                                column.dataIndex === 'healthProblemRiskName' ||
                                                column.dataIndex === 'healthRangeName'
                                            "
                                        >
                                            <div class="father-div">
                                                <div class="status-div" :style="getStyle(text)"></div>
                                            </div>
                                        </template>
                                        <template
                                            v-if="
                                                column.dataIndex === 'healthRemark' ||
                                                column.dataIndex === 'responsibleName'
                                            "
                                        >
                                            <div>
                                                <div
                                                    class="align-left"
                                                    v-for="(line, index) in text?.split('\n')"
                                                    :key="index"
                                                >
                                                    {{ line }}
                                                </div>
                                            </div>
                                        </template>
                                    </template>
                                </a-table>
                            </div>
                            <div class="content-tip"> 进展概况 </div>
                            <div class="week-title"
                                >本周 [ {{ item.startDate }}-{{ item.endDate }} ] - 主要工作内容
                            </div>
                            <div class="week-content">
                                <div v-for="(line, index) in item.progressFinish.split('\n')" :key="index">
                                    {{ line }}
                                </div></div
                            >
                            <div class="week-title"
                                >本周 [ {{ item.startDate }}-{{ item.endDate }} ] - 主要工作目标
                            </div>
                            <div class="week-content">
                                <div v-for="(line, index) in item.progressGoals.split('\n')" :key="index">
                                    {{ line }}
                                </div>
                            </div>
                            <div class="content-tip"> 持续跟进事项 </div>
                            <div class="default-table">
                                <a-table
                                    :columns="actionColumns"
                                    :data-source="item.weekReportActionDtoList"
                                    :pagination="false"
                                    bordered
                                >
                                    <template #bodyCell="{ column, record, text }">
                                        <template v-if="column.dataIndex === 'remark'">
                                            <div>
                                                <div
                                                    class="align-left"
                                                    v-for="(line, index) in text.split('\n')"
                                                    :key="index"
                                                >
                                                    {{ line }}
                                                </div>
                                            </div>
                                        </template>
                                        <template
                                            v-if="
                                                column.dataIndex === 'remark' ||
                                                column.dataIndex === 'actionName' ||
                                                column.dataIndex === 'actionSuggest'
                                            "
                                        >
                                            <div>
                                                <div
                                                    class="align-left"
                                                    v-for="(line, index) in text.split('\n')"
                                                    :key="index"
                                                >
                                                    {{ line }}
                                                </div>
                                            </div>
                                        </template>
                                    </template>
                                </a-table>
                            </div>
                            <div class="content-tip"> 问题、风险及待决策事项 </div>
                            <div class="default-table">
                                <a-table
                                    :columns="questionColumns"
                                    :data-source="item.weekReportProblemRiskDecisionDtoList"
                                    :pagination="false"
                                    bordered
                                >
                                    <template #bodyCell="{ column, record, text }">
                                        <template
                                            v-if="
                                                column.dataIndex === 'remark' ||
                                                column.dataIndex === 'actionName' ||
                                                column.dataIndex === 'actionSuggest' ||
                                                column.dataIndex === 'responsibleName'
                                            "
                                        >
                                            <div>
                                                <div
                                                    class="align-left"
                                                    v-for="(line, index) in text.split('\n')"
                                                    :key="index"
                                                >
                                                    {{ line }}
                                                </div>
                                            </div>
                                        </template>
                                    </template>
                                </a-table>
                            </div>
                        </div>
                    </div>
                </a-spin>
            </div>
            <!-- end vid_q2pj193dfc 自定义模板_7xu4mdl9mj -->
        </a-spin>
        <div class="pagination-div">
            <a-pagination
                v-model:current="pagination.current"
                :total="pagination.total"
                :page-size="pagination.pageSize"
                @show-size-change="pageSizeChange"
                @change="pageChange"
            />
        </div>
    </div>
</template>
<script setup lang="tsx">
    import {
        h,
        ref,
        reactive,
        toRaw,
        markRaw,
        watch,
        computed,
        onBeforeMount,
        onMounted,
        onBeforeUnmount,
        onUnmounted,
        onActivated,
        onDeactivated
    } from 'vue'
    import { useRoute, useRouter } from 'vue-router'
    const router = useRouter()
    const route = useRoute()
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios'
    import {
        cloneDeep,
        localGet,
        merge,
        getDifferenceArray,
        traversalTreeStructure,
        checkCaseCondition,
        renderStringInTemplate,
        handleBreadcrumbJump,
        throttle,
        permission,
        getComponentParamsValue
    } from '@/utils'
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is'
    import dayjs from 'dayjs'
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart'
    import { message, notification, Modal } from 'ant-design-vue'
    import { propertyFormatByNumber, propertyFormatByPercentage, propertyFormatByDate } from '@/utils/format'
    import colorTheme from '@/design/custom-theme.json'
    /*** PUBLISH_EXEGESIS ***
 import UserTableRecords from '@/model/UserTableRecords';
 import { getAppBaseUrl } from '@/utils/index';
 import { sendToken } from "@/hooks/useIframeToken";
 import { useSystemStore } from "@/store/modules/system";
 const systemStore = useSystemStore();
 *** PUBLISH_EXEGESIS ***/

    // 获取传入的流程ID和组件参数
    const props = defineProps({
        'processInstanceId': {
            type: [String, Number, Boolean],
            default: undefined
        }
    })
    const immediateWatch = (source, callback) => {
        watch(source, callback, { deep: true, immediate: true })
    }

    /* -------------------------- 属性定义 -------------------------- */

    const setTimeOutList = []
    const pageLoading = reactive({
        loading: false,
        tip: undefined
    })
    const authInfo = localGet('app-user-store')

    // 处理校验
    const setSubFormName = (parentInfo, name) => {
        return [parentInfo.parents, parentInfo.cycleIndex, name]
    }

    /* ========================== 属性定义 ========================== */

    /* -------------------------- 元素数据引用 -------------------------- */

    /* ========================== 元素数据引用 ========================== */

    /* -------------------------- 页面数据 -------------------------- */

    /* ========================== 页面数据 ========================== */

    /* -------------------------- 响应 -------------------------- */

    /* ========================== 响应 ========================== */

    /* -------------------------- 函数 -------------------------- */

    /* ========================== 函数 ========================== */

    /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId
    })

    /* ========================== 页面参数 ========================== */

    /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------

    // ============================ 组件数据同步 ============================

    /* ========================== 组件事件处理方法 ========================== */

    /* -------------------------- 生命周期 -------------------------- */
    // 用于参数变更后重新执行自定义指令
    const queryUpdateFlag = ref(0)
    onMounted(() => {})

    onUnmounted(() => {
        // 销毁定时器
        setTimeOutList.forEach(({ repeat, timer }) => {
            repeat ? clearInterval(timer) : clearTimeout(timer)
        })
    })

    /* ========================== 生命周期 ========================== */

    /* -------------------------- 数据关联处理 -------------------------- */

    /* -------------------------- 表单数据同步 -------------------------- */
    /* ========================== 表单数据同步 ========================== */

    /* ========================== 数据关联处理 ========================== */

    /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

    /* ========================== 不同组件自定义的处理逻辑 ========================== */

    // ================================定制化逻辑========================================
    import isoWeek from 'dayjs/plugin/isoWeek'

    dayjs.extend(isoWeek)

    onMounted(() => {
        // 获取当前日期
        const today = dayjs()
        // 计算本周的周一和周日
        const startOfWeek = today.startOf('week').add(1, 'day').format('YYYY-MM-DD') // 周一
        const endOfWeek = today.endOf('week').add(1, 'day').format('YYYY-MM-DD') // 周日
        // 输出结果
        const currentWeekRange = [startOfWeek, endOfWeek]
        const s = dayjs(today).startOf('week').format('M月D日')
        const e = dayjs(today).endOf('week').format('M月D日')
        const timeFrame = [`${s}-${e}`]
        state.searchWeek = dayjs(startOfWeek)
        state.filterWeek = currentWeekRange
        getDataList()
        getAllJfPeople()
        getRegionList()
        getFactoryList()
    })
    const state = reactive({
        visible: false,
        title: '新建周报',
        filterRegion: undefined,
        formModel: {
            configAreaId: undefined,
            time: '',
            configAreaId: undefined,
            stageId: undefined,
            factoryCode: undefined,
            healthRemark: undefined,
            progressFinish: undefined,
            progressGoals: undefined,
            dateRangeList: [],
            weekReportActionFormList: [],
            weekReportProblemRiskDecisionFormList: []
        },
        dataSource: [],
        searchWeek: '',
        filterWeek: [],
        regionList: [],
        treeData: [],
        miltpostList: [],
        deleteVisible: false,
        changeVisible: false,
        changeRecord: [],
        okBtnLoading: false,
        spinng: false
    })
    const plainOptions = [
        { label: '绿色', value: 'GREEN' },
        { label: '黄色', value: 'YELLOW' },
        { label: '红色', value: 'RED' },
        { label: '黑色', value: 'BLACK' }
    ]
    const healthColumns = ref([
        {
            title: '项目阶段',
            align: 'center',
            dataIndex: 'stageName'
        },
        {
            title: '项目健康状态',
            align: 'center',
            resizable: true,
            children: [
                {
                    title: '范围',
                    dataIndex: 'healthRangeName',
                    align: 'center',
                    width: 160,
                    ellipsis: true,
                    resizable: true
                },

                {
                    title: '计划',
                    dataIndex: 'healthPlanName',
                    align: 'center',
                    width: 160,
                    ellipsis: true,
                    resizable: true
                },
                {
                    title: '团队',
                    dataIndex: 'healthTeamName',
                    align: 'center',
                    width: 160,
                    ellipsis: true,
                    resizable: true
                },
                {
                    title: '跨组协同',
                    dataIndex: 'healthCrossGroupName',
                    align: 'center',
                    width: 160,
                    ellipsis: true,
                    resizable: true
                },
                {
                    title: '问题风险',
                    dataIndex: 'healthProblemRiskName',
                    align: 'center',
                    width: 160,
                    ellipsis: true,
                    resizable: true
                }
            ]
        },
        {
            title: '特别说明',
            align: 'center',
            width: 400,
            dataIndex: 'healthRemark'
        }
    ])
    const actionColumns = ref([
        {
            title: '持续跟进事项',
            align: 'center',
            width: 400,
            dataIndex: 'actionName'
        },
        {
            title: '行动建议',
            align: 'center',
            width: 400,
            dataIndex: 'actionSuggest'
        },
        {
            title: '提出日期',
            align: 'center',
            dataIndex: 'actionHappenDate'
        },
        {
            title: '预计完成日期',
            align: 'center',
            dataIndex: 'actionFinishDate'
        },
        {
            title: '是否完成',
            align: 'center',
            dataIndex: 'isFinish'
        },
        {
            title: '备注',
            align: 'center',
            width: 400,
            dataIndex: 'remark'
        }
    ])
    const questionColumns = ref([
        {
            title: '责任人',
            align: 'center',
            dataIndex: 'responsibleName'
        },
        {
            title: '问题/风险/决策类型',
            align: 'center',
            width: 280,
            dataIndex: 'category'
        },
        {
            title: '问题/风险/决策事项描述',
            align: 'center',
            width: 280,
            dataIndex: 'actionName'
        },
        {
            title: '问题/风险等级 (高/中/低)',
            align: 'center',
            width: 200,
            dataIndex: 'problemRisk'
        },
        {
            title: '行动建议',
            align: 'center',
            width: 200,
            dataIndex: 'actionSuggest'
        },
        {
            title: '提出日期',
            align: 'center',
            dataIndex: 'actionHappenDate'
        },
        {
            title: '预计完成日期',
            align: 'center',
            dataIndex: 'actionFinishDate'
        },
        {
            title: '备注',
            align: 'center',
            dataIndex: 'remark'
        }
    ])
    const columns = [
        {
            title: '所属模块',
            dataIndex: 'fieldName'
        },
        {
            title: '变更类型',
            dataIndex: 'category'
        },
        {
            title: '变更前',
            dataIndex: 'beforeChange'
        },
        {
            title: '变更后',
            dataIndex: 'afterChange'
        },
        {
            title: '变更人',
            dataIndex: 'createdBy'
        },
        {
            title: '变更时间',
            dataIndex: 'createdTime'
        }
    ]
    //从项目参与人中取人名让任务用
    const peopleList = ref([])

    // 交付参与人s所有人
    function getAllJfPeople() {
        get('/solution-ppm/api/v2/built-in-system-ppm/pmgf/get/allUser').then(({ data }) => {
            peopleList.value = data.userDtoList.map(item => {
                return {
                    label: item.name,
                    value: item.id
                }
            })
        })
    }
    // 获取工厂
    function getFactoryList() {
        get('/solution-ppm/api/v2/built-in-system-ppm/cooperation/config_region/project_tree').then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            state.treeData = data.data
        })
    }
    // 获取区域
    function getRegionList() {
        post('/solution-ppm/api/v2/built-in-system-ppm/cooperation/config_region/search ').then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            state.regionList = data.data
        })
    }
    // 获取项目阶段
    function getMilepost() {
        if (state.formModel.factoryCode && state.formModel.factoryCode && state.formModel.dateRangeList) {
            post('/solution-ppm/api/v2/built-in-system-ppm/week_report/template_stage/search', {
                areaCode: state.formModel.configAreaId,
                factoryCode: state.formModel.factoryCode,
                dateRangeList: state.formModel.dateRangeList
            }).then(data => {
                if (data.code !== 200) {
                    message.error(data.message)
                    return
                }
                state.miltpostList = data.data
            })
        }
    }
    // 日期格式化
    const weekFormat = date => {
        const year = date.year()
        const month = date.month() + 1
        // 获取当月的第一天
        const firstDayOfMonth = dayjs(date).startOf('month')
        // 计算当前日期是本月的第几周
        const weekOfMonth = date.week() - firstDayOfMonth.week() + 1
        return `${year}年${month}月第${weekOfMonth}周`
    }
    // 筛选日期格式化
    const handleWeekChange = date => {
        const startOfWeek = dayjs(date).startOf('isoWeek').format('YYYY-MM-DD')
        const endOfWeek = dayjs(date).endOf('isoWeek').format('YYYY-MM-DD')
        state.filterWeek = [startOfWeek, endOfWeek]
        if (!date) {
            state.filterWeek = []
        }
        getDataList()
    }
    const handleFormWeekChange = date => {
        const startOfWeek = dayjs(date).startOf('isoWeek').format('YYYY-MM-DD')
        const endOfWeek = dayjs(date).endOf('isoWeek').format('YYYY-MM-DD')
        state.formModel.dateRangeList = [startOfWeek, endOfWeek]
        getLast()
    }
    // 跟进事项
    const actionItem = {
        actionName: '',
        actionSuggest: '',
        actionHappenDate: '',
        actionFinishDate: '',
        isFinish: '',
        remark: ''
    }
    //     问题、风险及待决策事项1
    const questionItem = {
        responsibleName: undefined,
        actionSuggest: '',
        actionHappenDate: '',
        actionFinishDate: '',
        isFinish: '',
        remark: '',
        category: '',
        problemRisk: ''
    }
    const formRef = ref(null)
    // 新建周报
    function handlerAddRecord() {
        state.title = '新建周报'
        state.formModel.weekReportProblemRiskDecisionFormList.push({ ...questionItem })
        state.formModel.weekReportActionFormList.push({ ...actionItem })
        state.visible = true
    }

    // 关闭弹窗
    function cancelRecord() {
        state.visible = false
        console.log(formRef.value)
        formRef.value.resetFields()
        currentData.value = {}
        state.formModel = {
            configAreaId: undefined,
            time: '',
            configAreaId: undefined,
            stageId: undefined,
            factoryCode: undefined,
            healthRemark: undefined,
            progressFinish: undefined,
            progressGoals: undefined,
            dateRangeList: [],
            weekReportActionFormList: [],
            weekReportProblemRiskDecisionFormList: []
        }
        resetForm()
    }
    function resetForm() {
        state.formModel = {
            configAreaId: undefined,
            time: '',
            configAreaId: undefined,
            stageId: undefined,
            factoryCode: undefined,
            healthRemark: undefined,
            progressFinish: undefined,
            progressGoals: undefined,
            dateRangeList: [],
            weekReportActionFormList: [],
            weekReportProblemRiskDecisionFormList: []
        }
        currentData.value = {}
    }
    //     保存周报

    function confirmRecord() {
        formRef.value.validate().then(() => {
            state.okBtnLoading = true
            if (!currentData.value.id) {
                //   新增
                post('/solution-ppm/api/v2/built-in-system-ppm/week_report/create   ', state.formModel)
                    .then(data => {
                        if (data.code !== 200) {
                            message.error(data.message)
                            return
                        }
                        message.success('添加成功')
                        state.visible = false
                        getDataList()
                        resetForm()
                    })
                    .finally(() => {
                        state.okBtnLoading = false
                    })
            } else {
                //   编辑
                post('/solution-ppm/api/v2/built-in-system-ppm/week_report/modify   ', {
                    ...state.formModel,
                    id: currentData.value.id
                })
                    .then(data => {
                        if (data.code !== 200) {
                            message.error(data.message)
                            return
                        }
                        message.success('修改成功')
                        state.visible = false
                        getDataList()
                        resetForm()
                    })
                    .finally(() => {
                        state.okBtnLoading = false
                    })
            }
        })
    }
    function handleEdit(item) {
        currentData.value = item
        state.title = '编辑周报'
        let deepItem = cloneDeep(item)
        state.formModel.factoryCode = deepItem.projectId
        state.formModel.configAreaId = deepItem.configAreaId
        state.formModel.time = dayjs(deepItem.dateRangeList[0])
        state.formModel.stageId = deepItem.stageId
        state.formModel.stageId = deepItem.stageId
        state.formModel.healthRemark = deepItem.healthRemark
        state.formModel.progressFinish = deepItem.progressFinish
        state.formModel.progressGoals = deepItem.progressGoals
        state.formModel.dateRangeList = deepItem.dateRangeList
        state.formModel.weekReportActionFormList = deepItem.weekReportActionDtoList
        state.formModel.weekReportProblemRiskDecisionFormList = deepItem.weekReportProblemRiskDecisionDtoList
        getRegionList()
        getFactoryList()
        getAllJfPeople()
        getMilepost()
        state.formModel.healthRangeName = deepItem.healthRangeCode
        state.formModel.healthPlanName = deepItem.healthPlanCode
        state.formModel.healthTeamName = deepItem.healthTeamCode
        state.formModel.healthCrossGroupName = deepItem.healthCrossGroupCode
        state.formModel.healthProblemRiskName = deepItem.healthProblemRiskCode
        state.visible = true
    }
    function handleDelete(item) {
        currentData.value = item
        state.deleteVisible = true
    }
    function handleCheck(item) {
        get(`/solution-ppm/api/v2/built-in-system-ppm/week_report/change_record/${item.id}/search`).then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            state.changeRecord = data.data
            state.changeVisible = true
        })
    }
    // 确定删除
    function confirmDeleteWork() {
        del(`/solution-ppm/api/v2/built-in-system-ppm/week_report/${currentData.value.id}`).then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            message.success('删除成功')
            state.deleteVisible = false
            getDataList()
        })
    }
    //     新增跟进事项
    function handlerAddAction() {
        state.formModel.weekReportActionFormList.push({ ...actionItem })
    }
    //     删除跟进事项
    function handlerDeleteAction(index) {
        if (state.formModel.weekReportActionFormList.length == 1) {
            message.info('至少有一条持续跟进事项')
            return
        }
        state.formModel.weekReportActionFormList.splice(index, 1)
    }
    //     新增问题、风险及待决策事项1
    function handlerAddQuestion() {
        state.formModel.weekReportProblemRiskDecisionFormList.push({ ...questionItem })
    }
    //     删除问题、风险及待决策事项1
    function handlerDeleteQuestion(index) {
        if (state.formModel.weekReportProblemRiskDecisionFormList.length == 1) {
            message.info('至少有一条问题、风险及待决策事项')
            return
        }
        state.formModel.weekReportProblemRiskDecisionFormList.splice(index, 1)
    }
    const pageSizeChange = (current, size) => {
        pagination.value.current = current
        pagination.value.pageSize = size
        getDataList()
    }
    const pageChange = (page, pageSize) => {
        pagination.value.current = page
        pagination.value.pageSize = pageSize
        getDataList()
    }
    const pagination = ref({
        current: 1,
        pageSize: 5,
        showSizeChanger: true,
        total: '0',
        pageSizeOptions: ['10', '15', '20', '25', '30'],
        showTotal: total => `共 ${total} 条数据`
    })
    // 获取列表
    function getDataList() {
        state.spinng = true
        post('/solution-ppm/api/v2/built-in-system-ppm/week_report/search', {
            dateRangeList: state.filterWeek,
            'pageNo': pagination.value.current,
            'pageSize': pagination.value.pageSize,
            searchType: 'ALL',
            configAreaId: state.filterRegion
        })
            .then(data => {
                if (data.code !== 200) {
                    message.error(data.message)
                    return
                }
                state.dataSource = data.data.dataList
                pagination.value.total = data.data.elementNumbers
            })
            .finally(() => {
                state.spinng = false
            })
    }
    // 新建时查询上次填写
    function getLast() {
        if (!currentData.value.id) {
            if (state.formModel.factoryCode && state.formModel.configAreaId && state.formModel.time) {
                post('/solution-ppm/api/v2/built-in-system-ppm/week_report/search_last', {
                    configAreaId: state.formModel.configAreaId,
                    factoryCode: state.formModel.factoryCode,
                    dateRangeList: state.formModel.dateRangeList
                }).then(data => {
                    if (data.code !== 200) {
                        message.error(data.message)
                        return
                    }
                })
            }
        }
    }
    const currentData = ref({})

    const colorMap = {
        '黑色': '#262626',
        '绿色': '#52C41A ',
        '红色': '#FF2A00',
        '黄色': '#FABA32'
    }
    //     获取颜色
    function getStyle(text) {
        return {
            backgroundColor: colorMap[text]
        }
    }
    function changeShow(checked,item){
      console.log(checked);
      // put(`/solution-ppm/api/v2/built-in-system-ppm/week_report/${item.id}/否`)
    }
</script>
<style lang="less" scoped>
    .page_root {
        width: 100%;
        height: 100%;
        overflow: auto;
    }
    .page_root :deep(.@{ant-prefix}-spin-nested-loading),
    .page_root :deep(.@{ant-prefix}-spin-container) {
        height: 100%;
    }
    .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper) {
        display: flex;
        flex-flow: column nowrap;
        justify-content: flex-start;
    }
    .page_root :deep(.@{ant-prefix}-table) {
        flex: auto;
        overflow: auto;
    }
    .table-moreBtn_down {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 100px;
    }

    .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
        background: #ebf1ff;
    }

    /*  表格树结构样式处理，展开按钮层级增加*/
    :deep(.@{ant-prefix}-table-row-expand-icon) {
        z-index: 1;
    }
    /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
    :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 15px !important;
        width: calc(100% - 15px);
    }
    :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 30px !important;
        width: calc(100% - 30px);
    }
    :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 45px !important;
        width: calc(100% - 45px);
    }
    :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 60px !important;
        width: calc(100% - 60px);
    }

    /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
    :deep(.@{ant-prefix}-transfer-list) {
        height: 100%;
        width: 50%;
    }
    /*样式*/
    .page_root {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    .title-tip {
        padding-left: 8px;
        height: 16px;
        line-height: 16px;
        border-left: 4px solid #3875ff;
        margin-bottom: 24px;
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 600;
    }
    /deep/ .my-page .aps-form-item-label,
    /deep/ .my-page .ant3-form-item-label {
        width: 115px;
    }
    .color-item {
        display: flex;
        align-items: center;
    }
    .cycle-green,
    .cycle-orange,
    .cycle-red,
    .cycle-black {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        margin-right: 8px;
    }
    .color-content {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
    }
    .cycle-green {
        background-color: #52c41a;
    }
    .cycle-orange {
        background: #faba32;
    }
    .cycle-red {
        background: #ff2a00;
    }
    .cycle-black {
        background: #262626;
    }
    .color-msg {
        font-size: 14px;
        color: #262626;
        font-weight: 400;
    }
    .progress-description {
        border-bottom: 1px solid #3875ff;
        margin-bottom: 16px;
    }
    .flex-div {
        padding-left: 8px;
        height: 16px;
        line-height: 16px;
        border-left: 4px solid #3875ff;
        margin-bottom: 24px;
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 500;
        display: flex;
        justify-content: space-between;
    }
    .del {
        position: relative;
        top: -4px;
    }
    .add-btn {
        margin-bottom: 20px;
    }
    .left-title {
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 600;
    }
    .item-content {
        display: flex;
        justify-content: space-between;
    }

    .no-data-img {
        width: 264px;
        height: 192px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .no-data-msg {
        position: absolute;
        top: 60%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #595959;
    }
    .pagination-div {
        position: absolute;
        right: 30px;
        bottom: -10px;
        padding: 10px;
        background: transparent; /* 可选：为背景添加颜色 */
    }
    .top-search {
        height: 64px;
        background-color: #fff;
        padding: 16px 24px;
        border-radius: 2px;
        margin-bottom: 16px;
    }
    .content {
        background-color: #fff;
        border-radius: 2px;
        padding: 24px;
        height: calc(100vh - 220px);
        overflow: auto;
        padding-bottom: 8px;
    }
    .item-title {
        display: flex;
        justify-content: space-between;
        height: 40px;
        border-bottom: 1px solid #d9d9d9;
    }
    .record-item {
        padding: 16px;
        padding-top: 10px;
        box-shadow: 0 0 12px 0 rgba(229, 229, 229, 0.8);
        border-radius: 4px;
        margin-bottom: 16px;
    }
    .title-left {
        display: flex;
        width: 70%;
        justify-content: space-between;
    }
    .title-icon {
        display: flex;
        font-size: 16px;
        color: #3875ff;
        font-weight: 500;
    }
    .title-name {
        margin-left: 8px;
        line-height: 30px;
    }
    .normal-font,
    .weight-font {
        font-size: 14px;
        color: #595959;
    }
    .weight-font {
        font-weight: 500;
        color: #262626;
    }
    .title-right {
        display: flex;
        padding-bottom: 10px;
    }
    .time-range,
    .create-time,
    .sub-time {
        line-height: 32px;
    }
    .kb-table-box:deep(.@{ant-prefix}-table-thead) > tr > th {
        background-color: #ebf1ff;
        color: #262626;
        font-weight: 600;
        padding: 0px 4px;
        border-right: 1px solid #d9d9d9 !important;
    }
    .kb-table-box:deep(
            .ant3-table.ant3-table-bordered
                > .ant3-table-container
                > .ant3-table-content
                > table
                > thead
                > tr:not(:last-child)
                > th
        ) {
        border-bottom: 1px solid #d9d9d9;
    }
    .kb-table-box :deep(.@{ant-prefix}-table-tbody) tr > td {
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 400;
        color: #595959;
        border-bottom: 1px solid #d9d9d9;
        padding: 6px 0;
        word-break: break-all;
    }
    .status-div {
        height: 28px;
        width: 28px;
        background: #52c41a;
        border-radius: 8px;
    }
    .father-div {
        display: flex;
        justify-content: center;
    }
    .content-tip {
        padding-left: 8px;
        height: 16px;
        line-height: 16px;
        border-left: 4px solid #3875ff;
        margin-bottom: 24px;
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 500;
        font-weight: 600;
        margin: 16px 0 12px 0;
    }
    .week-title {
        font-size: 14px;
        color: #3875ff;
        letter-spacing: 0;
        font-weight: 500;
        margin-bottom: 8px;
    }
    .week-content {
        border: 1px solid #d9d9d9;
        border-radius: 4px;
        padding: 8px;
        margin-bottom: 12px;
        min-height: 64px;
    }
    .week-content:last-child {
        margin-bottom: 16px;
    }
    .default-table:deep(.@{ant-prefix}-table-thead) > tr > th {
        background-color: #3875ff;
        color: #fff;
        font-weight: 600;
        padding: 8px 16px;
        border-right: 1px solid #d9d9d9;
    }
    .default-table :deep(.@{ant-prefix}-table-tbody) tr > td {
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 400;
        color: #595959;
        border-bottom: 1px solid #d9d9d9;
        padding: 8px 16px;
        word-break: break-all;

        .cell-wrapper {
            padding: 0 16px;
        }
    }
    .align-left {
        text-align: left;
    }
</style>
